import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:convert';

part 'special_unique_id_response.freezed.dart';
part 'special_unique_id_response.g.dart';

@freezed
class SpecialUniqueIdResponse with _$SpecialUniqueIdResponse {
  const factory SpecialUniqueIdResponse({
    @JsonKey(name: "c") required int c,
    @JsonKey(name: "m") required String m,
    @JsonKey(name: "d") required D d,
  }) = _SpecialUniqueIdResponse;

  factory SpecialUniqueIdResponse.fromJson(Map<String, dynamic> json) =>
      _$SpecialUniqueIdResponseFromJson(json);
}

@freezed
class D with _$D {
  const factory D({
    @JsonKey(name: "id") required String id,
    @JsonKey(name: "title") required String title,
    @JsonKey(name: "desc") required String desc,
    @JsonKey(name: "ratio") required double ratio,
    @JsonKey(name: "banner") required String banner,
    @JsonKey(name: "thumb") required String thumb,
    @JsonKey(name: "slide") required String slide,
    @JsonKey(name: "url") required String url,
    @JsonKey(name: "classes") required List<Class> classes,
    @JsonKey(name: "list") required List<dynamic> list,
  }) = _D;

  factory D.fromJson(Map<String, dynamic> json) => _$DFromJson(json);
}

@freezed
class Class with _$Class {
  const factory Class({
    @JsonKey(name: "id") required String id,
    @JsonKey(name: "name") required String name,
    @JsonKey(name: "order") required int order,
  }) = _Class;

  factory Class.fromJson(Map<String, dynamic> json) => _$ClassFromJson(json);
}
